<div class="container">
	<div class="tabbable tabs-left" id="admin_bar">
		<%= render 'shared/admin_bar'%>
		<div class="tab-content">
			<div class="row-fluid">
				<h1 class="span12"> <%= t 'xu_ly_don_hang'%> </h1>

			</div>
			<div class="row-fluid">
				<div class="span12">
					<% if flash.now[:loi]%>
					<p class="alert alert-error">
						<%= flash.now[:loi]%>
					</p>
					<% end %>
					<% if flash.now[:thanh_cong]%>
					<p class="alert alert-success">
						<%= flash.now[:thanh_cong]%>
					</p>
					<% end %>
				</div>
			</div>
			<div class="row-fluid">
				<div class="span12">
					<% if @gio_hang.da_xu_ly %>
					<span class="label label-success"><%= t 'da_xu_ly'%></span>
					<% else %>
					<span class="label label-warning"><%= t 'dang_cho'%></span>
					<% end %>
				</div>
			</div>
			<%= form_tag request.url, :method => "post" do %>
			<div class="row-fluid">
				<table class="table table-stripped span12">
					<tr class="">
						<th><%= t 'ten_nguoi_dat_hang'%></th>
						<td><%= @gio_hang.nguoi_dung.ten_hien_thi%></td>
					</tr>
					<tr>
						<th><%= t 'thoi_gian_dat_hang'%></th>
						<td><%= @gio_hang.thoi_gian_dat_hang.strftime('%Y-%m-%d %H:%M:%S')%></td>
					</tr>
					<tr>
						<th><%= t 'dia_chi_nhan_hang'%></th>
						<td><%= text_field_tag  :dia_chi_nhan_hang, @gio_hang.dia_chi_nhan_hang, :class=> "input-xxlarge" %></td>
					</tr>
					<tr>
						<th><%= t 'dien_thoai_lien_lac'%></th>
						<td><%= @gio_hang.dien_thoai_lien_lac%></td>
					</tr>
				</table>

			</div>
			<div class="row-fluid">
				<div class="span12"></div>
				<table class="table table-bordered gio_hang">
					<tr>
						<th colspan="2"><%= t'san_pham'%></th>
						<th><%= t'so_luong'%></th>
						<th><%= t'thanh_tien'%></th>
					</tr>
					<% for sp in @gio_hang.san_pham_muas %>
					<tr>
						<td class="sp_avatar"><img class="img-rounded" src="<%= sp.san_pham.hinh_anh %>"></td>
						<td class="sp_noi_dung"><h4><a href="<%= url_for :action=>'index', :controller=>'/san_pham', :danh_muc_slug => sp.san_pham.danh_muc.slug, :san_pham_slug => sp.san_pham.slug %>"><%= sp.san_pham.noi_dung(@ngon_ngu, true).tieu_de%></a></h4>
						<p>
							<span><%= t'gia_mua'%></span><span> <strong><%= number_with_delimiter sp.gia_mua, :delimiter => " " %></span></strong><span class="tien_te">VND</span>
						</p></td>
						<td class="sp_so_luong"> <% if @cho_phep_edit %>
						<%= text_field_tag "san_pham[#{sp.id}][so_luong]", sp.so_luong %>
						<% else %>
						<%= sp.so_luong %>
						<% end %> </td>
						<td class="sp_thanh_tien"> <%= number_with_delimiter(sp.so_luong * sp.gia_mua, :delimiter => " ") %> </td>
					</tr>
					<% end %>
					<tr>
						<th colspan="3" class="text-right"><%= t'tong_tien'%></th>
						<td class="sp_tong_tien"><%= number_with_delimiter @gio_hang.tong_gia_tri, :delimiter => " "%> <span class="tien_te">VND</span></td>
					</tr>
				</table>
			</div>
			<div class="row-fluid">
				<div class="span12">
					<p>
						<%= label_tag(:nhan_vien_id, t('nhan_vien_giao_hang'))%>
						<%= select_tag(:nhan_vien_id, options_for_select([[t('chon_nhan_vien'), ""]] + @nhan_viens.map{|o| [o.ten_hien_thi, o.id.to_s]}, (@gio_hang.nhan_vien_giao_hang ? @gio_hang.nhan_vien_giao_hang.id : "") )) %>
					</p>
					<p>
						<%= submit_tag(t('cap_nhat'), :class=> 'btn btn-primary') %>
					</p>
				</div>
			</div>
			<% end %>
		</div>

	</div>
</div>
